function searchTitle(search) {
    var sid = $('#category option:selected').val();
    var text = search.value;
    var page = 0;
    var uname = "";
    if (text=="根据提问人搜索"){
        uname = text;
        text = "";
        sid = 0;
    }
    $.post("faq/search",{uname:uname,text:text,sid:sid,page:page}, function(obj) {
        $("#question").html(obj)

        // $("#question").html("<c:forEach items='${qlist};' var='q'><div class='_sin98ufaq'><h4>${q.qtext}" +
        //     "<span style='float: right'>提问人："+"${q.uid.uname}"+"。时间："+"${q.qsend}"+"</span></h4><c:forEachitems='${alist}' var='a'>" +
        //     "<c:if test='${q.qid==a.qid}'><p>"+"${a.ttext}"+"</p></c:if></c:forEach></div></c:forEach>");
    });
}
function futext(){
    var text = editor.txt.text();
    var uid = $("#uid").val();
    var sid = $("#language option:selected").val();
    if(text==""){
        alert("请输入问题")
    } else {
        if(uid==""){
            alert("请先登录后再询问");
            location="jump/tologin";
        } else {
            $.post("faq/sendquestion",{qtext:text,sid:sid},function (obj) {
                if (obj==1){
                    alert("发送成功");
                    location="jump/tofaq";
                } else {
                    alert("发送失败")
                }
            });

        }
    }

}
var count = 0;
function showReview(a) {
    var uid = $("#uid").val();
    if (uid!=""){
        if (count%2==0){
            var qid = a.getAttribute("displayname")
            document.getElementById(qid).removeAttribute("hidden")
        } else {
            var qid = a.getAttribute("displayname")
            document.getElementById(qid).hidden = "false";
        }
        count++;
    } else {
        alert("请先登录")
        location="jump/tologin";
    }

}
function deleteReview(a) {
    var flag = confirm("确认删除该问题？该问题下的回答也会被删除，此操作不可逆")
    if(flag){
        var qid = a.getAttribute("displayname")
        location="faq/deleteReview/"+qid;
    }
}
function deleteAnswer(a) {
    var flag = confirm("确认删除该条回答？此操作不可逆")
    if(flag){
        var tid = a.getAttribute("displayname")
        location="faq/deleteAnswer/"+tid;
    }
}
function showAnswer(a) {
    var qid = a.getAttribute("displayname");
    var aid = a.getAttribute("displayname2");
    a.hidden = "false";
    // $('#'+qid).css({ "display": "block" });
    document.getElementById(aid).removeAttribute("hidden");
    document.getElementById(qid).removeAttribute("hidden");
}
function hiddenAnswer(a) {
    var qid = a.getAttribute("displayname");
    var aid = a.getAttribute("displayname2");
    a.hidden= "false";
    // $('#'+qid).css({ "display": "none" });
    document.getElementById(aid).removeAttribute("hidden");
    document.getElementById(qid).hidden = "false"

}
